import sys
sys.path.append("C:\\Panda3D-1.7.2\\")
from direct.showbase.DirectObject import DirectObject
from direct.task import Task
from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *

class Nest(DirectObject):
    def __init__(self):
        
        # 9/29/2011 Using ODE now
        #self.node = NodePath('physicsNode')
        self.node.reparentTo(render)
        #self.nestNode = ActorNode('nest')
        #self.nestNodePath = self.node.attachNewNode(self.nestNode)       
        self.nest = self.loadObject(loader.loadTexture("../media/nest1.png"))
        self.nest.reparentTo(self.nestNodePath)

        self.nestNodePath.setScale(1)
        self.nestNodePath.setPos(0,10,0)


    def setPhysics(self):
        #self.nestNode.getPhysicsObject().setMass(1)
        #base.physicsMgr.attachPhysicalNode(self.nestNode)

        #self.antiGrav = ForceNode('no grav')
        #self.antiGravNP = self.node.attachNewNode(self.antiGrav)
        #self.antiGravF = LinearVectorForce(0,0,9.81)
        #self.antiGrav.addForce(self.antiGravF)
        #self.nestNode.getPhysical(0).addLinearForce(self.antiGravF)
        pass
    def setCollision(self,traverser):
        #self.ColSphere = CollisionSphere(0,0,0,.5)
        #self.ColSphereNodePath = self.nest.attachNewNode(CollisionNode('nestSphere'))
        #self.ColSphereNodePath.node().addSolid(self.ColSphere)
        #self.ColSphereNodePath.show()

        #base.physics.addCollider(self.ColSphereNodePath, self.nestNodePath)
        #base.cTrav.addCollider(self.ColSphereNodePath, base.physics)
        pass

    def loadObject(self, textureobj):
        obj = loader.loadModel("../media/plane")
        obj.reparentTo(render)
        obj.setBin("unsorted", 0)
        obj.setDepthTest(False)

        obj.setTransparency(1)
        obj.setTexture(textureobj, 1)
        return obj
